<template>
  <div>
    <el-input v-model="search.input" placeholder="请输入内容">
      <template #prepend>
        <el-select v-model="search.select" placeholder="请选择" style="width: 100px;">
          <el-option label="人物" value="1" />
          <el-option label="电影" value="2" />
          <el-option label="音乐" value="3" />
          <el-option label="书籍" value="4" />
        </el-select>
      </template>
      <template #append>
        <el-button icon="el-icon-search" @click="onSearch" />
      </template>
    </el-input>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive } from 'vue'
export default defineComponent({
  name: 'SearchBox',
  props: {},
  setup() {
    const search = reactive({
      select: '1',
      input: ''
    }) 
    
    // 点击查询
    function onSearch() {
      console.log(search)
    }

    return {
      search,
      onSearch,
    }
  },
})
</script>

<style lang="scss" scoped>
//
</style>
